package com.example;

import java.util.*;

public class Main {
    public static void main(String[] args) {
//        Scanner sc = new Scanner(System.in);
//        int num = sc.nextInt();
//        sc.nextLine();


            String[] ss = new String[]{"20CNY53fen", "53HKD87cents"};
//            String[] ss = new String[]{"123HKD"};
        int sum = 0;
        for(String data: ss){
            Money money = split(data);
            sum += money.toFen();
        }
        System.out.println(sum);
    }
    
    private static Money split(String data) {
        char[] chars = data.toCharArray();
        StringBuilder numBuilder = new StringBuilder();
        boolean numSep = false;
        StringBuilder cenBuilder = new StringBuilder();
        boolean cenSep = false;
        boolean first = true;
        for (char c: chars) {
            if (c >= '0' && c <= '9') {
                if (!first && !cenSep) {
                    cenBuilder.append(" ");
                    cenSep = true;
                }
                numBuilder.append(c);
            } else {
                first = false;
                if (!numSep) {
                    numBuilder.append(" ");
                    numSep = true;
                }
                cenBuilder.append(c);
            }
        }
        String[] nums = numBuilder.toString().split(" ");
        String[] cen = cenBuilder.toString().split(" ");
        return new Money(Integer.parseInt(nums[0]), nums.length > 1 ? Integer.parseInt(nums[1]) : 0, cen[0]);
    }
    
    static class Money {
        private String cen;
        private int num;
        private int fen;
        
        public Money(int num, int fen, String cen) {
            this.num = num;
            this.fen = fen;
            this.cen = cen;
        }
        
        public int toFen() {
            switch (cen) {
                case "CNY":
                    return num * 100 + fen;
                case "fen":
                    return num;
                case "JPY":
                    return (int)((num + fen / 100.0) / 1825 * 10000);
                case "sen":
                    return (int)((num / 100.0) / 1825 * 10000);
                case "HKD":
                    return (int)((num + fen / 100.0) / 123 * 10000);
                case "cents":
                    return (int)((num / 100.0) / 123 * 10000);
                case "EUR":
                    return (int)((num + fen / 100.0) / 14 * 10000);
                case "eurocents":
                    return (int)((num / 100.0) / 14 * 10000);
                case "GBP":
                    return (int)((num + fen / 100.0) / 12 * 10000);
                case "pence":
                    return (int)((num / 100.0) / 12 * 10000);
                default:
                    return 0;
            }
        }
    }
}